package cn.xyf.mzmy.server.service.user;

import cn.xyf.mzmy.server.dal.dataobject.user.User;
import cn.xyf.mzmy.server.dal.mysql.user.UserMapper;
import cn.xyf.mzmy.server.service.user.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xyf
 * @since 2025-07-23
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @Cacheable(value = "users" + "#60", key = "#id")        // 设置key为users:id，value为返回值，60s有效期
    public User queryById(Long id) {
        return userMapper.selectById(id);
    }


}
